package com.itany.corejava.code12_线程;

/**
 * @author Miss Chen
 * @version 1.0
 * @date 2024年07月30日14:16
 */
public class Test07_sleep_interrupt {
    public static void main(String[] args) {
        MyThread2 mt=new MyThread2();
        mt.setName("mt");
        mt.setPriority(10);
        mt.start();

        for(int i=0;i<100;i++){
            System.out.println(Thread.currentThread().getName()+"正在打印:"+i);
        }
        mt.interrupt();
    }
}
class MyThread2 extends Thread{
    @Override
    public void run() {
       for(int i=0;i<10;i++){
           try {
               Thread.sleep(5000);
           } catch (InterruptedException e) {

               System.out.println("休眠状态被中断了");
           }
           System.out.println(Thread.currentThread().getName()+"正在打印:"+i);
       }
    }
}

